package com.binguo.service;

import com.binguo.model.model.CashierDesk;
import com.binguo.model.repository.CashierDeskRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author yuritian
 * @Title: DeskService
 * @ProjectName binguoDevelop
 * @Description: TODO
 * @date 2020/3/1611:15
 */
@Service
public class DeskService {
    @Autowired
    private CashierDeskRepository cashierDeskRepository;

    public String getDeskName(Integer deskId){

        CashierDesk desk = cashierDeskRepository.findById(deskId);

        String name = desk.getName();

        String[] splitName = desk.getName().split("\\-");


        if (splitName.length == 3){
            name = splitName[2];
        }

        return name;
    }
}
